function toAccordion(menus){
	if(typeof(menus)=="string"){
		menus=eval("("+menus+")");
	}
	var childKey = "children";
	if (!menus) {
		return [];
	}
	var r = [];
	var tmpMap = [];
	for (i=0, l=menus.length; i<l; i++) {
		tmpMap[menus[i].id] = menus[i];
	}
	for (i=0, l=menus.length; i<l; i++) {
		if (tmpMap[menus[i].pId]) {
			if (!tmpMap[menus[i].pId][childKey])
				tmpMap[menus[i].pId][childKey] = [];
			tmpMap[menus[i].pId][childKey].push(menus[i]);
		} else {
			r.push(menus[i]);
		}
	}
	return r;
}


